<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="input" placeholder="请输入密码">
    <script>
        var input = document.getElementById("input");
        var reg =/^[A-z]+\d{6,}$/;//字母开头 至少六位数字
        input.onkeyup = function(e){
            if(e.keyCode==13){
                var value = this.value;
                console.log(reg.test(value))
            }
        }
    </script>
</body>
</html>